package com.chen.q2.fibo;

import java.util.concurrent.Callable;

public class FiboAdderCallable implements Callable<Integer> {
    private final int toNum;

    public FiboAdderCallable(int toNum) {
        this.toNum = toNum;
    }

    @Override
    public Integer call() throws Exception {
        return fibo(toNum);
    }

    private static int fibo(int a) {
        if ( a < 2){
            return 1;
        }
        return fibo(a-1) + fibo(a-2);
    }
}
